package com.springark.ms.samplegoods.service;

import com.springark.ms.sampleapi.GoodsService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author hankchan
 * @since 2019/5/8
 */
@RefreshScope
@Service
public class GoodsServiceImpl implements GoodsService {

    @Value("${goods.list}")
    private String goods;

    public List<String> get(String requestId) {
        if(null == goods || goods.isEmpty()) {
            return new ArrayList<>();
        }
        return Arrays.asList(goods.split(","));
    }
}
